using System;
using System.Collections.Generic;
using System.Text;
using System.Configuration;
using NUnit.Framework;
using NHibernate.Repository;
using Neuparts.Shipping.Entities;
using Neuparts.Shipping.Repository;

namespace Neuparts.Shipping.Tests.Repositories
{
    [TestFixture]
    public class PackageRepositoryTests
    {
        [Test]
        public void CanCreatePackageRepository_Valid()
        {
            PackageRepository packages = new PackageRepository(GetConfigPath());
            Assert.IsNotNull(packages);
        }

        [Test]
        public void CanSavePackageDetails_Valid()
        {
            PackageRepository packages = new PackageRepository(GetConfigPath());
            PackageDetails detail = new PackageDetails();
            detail.ShipmentId = 4;
            detail.Barcode = Guid.NewGuid().ToString();

            Assert.IsNull(detail.Id);
            

            Assert.IsNotNull(detail.Id);


        }


        [Ignore]
        private static string GetConfigPath()
        {
            return ConfigurationManager.AppSettings.Get("InventoryManager.Config.Path");
        }
    }
}
